package com.example.jiaju.behavior;

import android.content.Context;
import android.content.res.Resources;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.example.jiaju.R;

public class HeaderSearchBehavior extends CoordinatorLayout.Behavior<View> {

    public HeaderSearchBehavior(Context context, AttributeSet attrs) {
        super(context, attrs);

//      argbEvaluator = new ArgbEvaluator();
    }

//    @Override
//    public boolean layoutDependsOn(@NonNull CoordinatorLayout parent, @NonNull View child, @NonNull View dependency) {
//        if (dependency != null && dependency.getId() == R.id.image) {
//            return true;
//        }
//        return false;
//    }

//    @Override
//    public boolean onDependentViewChanged(@NonNull CoordinatorLayout parent, @NonNull View child, @NonNull View dependency) {
//        if (dependency != null && dependency.getId() == R.id.image) {
//            Resources resources = dependency.getResources();
//            final float progress = 1.f -
//                    Math.abs(dependency.getTranslationY() / (dependency.getHeight() -resources.getDimension(R.dimen.collapsed_header_height)));
//            TextView tv = child.findViewById(R.id.toolbar_tv);
//            tv.setAlpha(progress);
//            return true;
//        }
//        return false;
//    }
}
